//
//  ViewController.m
//  OCfrist
//
//  Created by 宋 on 15/11/6.
//  Copyright © 2015年 宋. All rights reserved.
//

#import "ViewController.h"
#import "TableViewController.h"
#import "Test2ViewController.h"
@interface ViewController ()
{
    UILabel * l;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.title = @"我的主页";
    self.view.backgroundColor = [UIColor yellowColor];
    l = [UILabel new];
    l.text = @"我的通讯录";
    
    [l sizeToFit];
    l.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height/2.0);
    l.textColor = [UIColor blackColor];
    [self.view addSubview:l];
    //按钮
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(102, 300, 100, 44);
    [btn setTitle:@"请点击" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    UIButton * btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.frame = CGRectMake(105, 330, 100, 44);
    [btn1 setTitle:@"🎀" forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(onClick1:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];

    
}
//第二控制器展示我的内容
- (void)onClick:(id)sender{
   TableViewController * con= [TableViewController new];
   [self.navigationController pushViewController:con animated:YES];
  
}

- (void)onClick1:(id)sender{
    Test2ViewController * con= [Test2ViewController new];
    [self.navigationController pushViewController:con animated:YES];
    
}

- (void)viewDidApper:(BOOL)animated{
    [super viewDidAppear:animated];
    [UIView animateWithDuration:1.6 animations:^{
        l.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height - 400);
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
